<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改红黑榜')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-redBlack-add" th:object="${redBlack}">
			<input id="listId" name="listId" type="hidden" th:field="*{listId}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label ">被检查单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="enterpriseName" id="enterpriseName" th:field="*{enterpriseName}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">招牌名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="shopSign" id="shopSign" th:field="*{shopSign}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">经营地址：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="address" id="address" th:field="*{address}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">类型：</label>
				<div class="col-sm-3">
                  <label class="radio-box">
                     
                        <input type="radio" checked="" value="1" id="status" name="listType" th:field="*{listType}" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                             红榜</label>
                  <label class="radio-box">
                        <input type="radio" value="0" id="status" name="listType" th:field="*{listType}" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                            黑榜</label>
                 </div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">评比时间：</label>
				<div class="col-sm-4">
                  <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                      <input type="text" class="form-control" name="evalTime" id="evalTime" th:value="${#dates.format(redBlack.evalTime,'yyyy-MM-dd')}" required>
                   </div>
                   <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 时间格式，如2020-12-02</span>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<script type="text/javascript">
	  	
		$("#form-redBlack-add").validate();
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
	
		function add() {
			var enterpriseName = $("input[name='enterpriseName']").val();
			var shopSign = $("input[name='shopSign']").val();
			var address = $("input[name='address']").val();
			var listType = $("input[name='listType']:checked").val();
			var evalTime = $("input[name='evalTime']").val();
			var listId = $("input[name='listId']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "redBlack/update",
				data : {
					"enterpriseName": enterpriseName,
					"shopSign": shopSign,
					"address": address,
					"listType": listType,
					"evalTime": evalTime,
					"listId": listId
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
	</script>
</body>
</html>
